package com.example.demo.web;

import com.example.demo.dao.BookMonthMapper;
import com.example.demo.entity.BookMonth;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RequestMapping("ssss")
@Controller
public class MonthControl {
    @Autowired
    BookMonthMapper bookMonthMapper;
    @PostMapping("charts")
    @ResponseBody
    public Map month(){
        Map map=new HashMap();
        List<BookMonth> list=bookMonthMapper.list2();
        String[] month=new String[list.size()];
        String[] nub=new String[list.size()];
        for (int j=0;j<list.size();j++){
            month[j]=list.get(j).getMonth();
            nub[j]=list.get(j).getNub();
        }
        map.put("mm",month);
        map.put("nub",nub);
        return map;
    }

}
